﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CNVP.JShop.UI;
using CNVP.Config;
using CNVP.Framework.Utils;
namespace CNVP.JShop.Web.Admin
{
    public partial class ReviewChangeStat : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!BLL.BLLCheckAdmin.LoginOk(Page, 129) || !BLL.BLLCheckAdmin.LoginOk(Page, 130)) return;//判断页面权限

            BLL.CNVP_Review bll = new BLL.CNVP_Review();
            int id = 0;
            Dictionary<int,string> statType=new Dictionary<int,string>();
            statType.Add(1, "IsTop");
            statType.Add(2, "IsShow");
            statType.Add(3, "IsDelete");
            var field = Request.QueryString["FieldID"];
            if (String.IsNullOrEmpty(field) || !Public.IsNumber(field) || (field != "1" && field != "2" && field != "3"))
            {
                MessageUtils.ShowPre("参数错误！");
            }
            if (Request.QueryString["ID"] != null && Request.QueryString["ID"].ToString() != "" && Public.IsNumber(Request.QueryString["ID"].ToString()))
            {
                id = Convert.ToInt32(Request.QueryString["ID"].ToString());
            }
            if (id > 0)
            {
                int rows;
                if (String.IsNullOrEmpty(Request.QueryString["value"]) || Request.QueryString["value"]=="false")
                {
                    rows = new BLL.CNVP_Review().ChangeReviewStatFalse(statType[Convert.ToInt32(field)], id);
                }
                else
                {
                    rows = new BLL.CNVP_Review().ChangeReviewStatTrue(statType[Convert.ToInt32(field)], id);
                }
                MessageUtils.ShowRedirect("修改完成。",Request.QueryString["GoToPage"] + ".aspx?Page=" + Request.QueryString["Page"] + "");
            }
            else
            {
                MessageUtils.ShowPre("参数错误！");
            }
        }
    }
}